<template>
  <div class="navgation">
    <div class="nav-center">
      <div class="left-log">
        <img src="../../imgs/logo.png" />
        <span class="name">高大上科技</span>
      </div>
      <ul>
        <li v-for="(item, index) in navList" :key="index">
          <router-link :to="item.path" active-class="active">{{
            item.title
          }}</router-link>
        </li>
      </ul>
      <div class="right-user">
        <img src="../../imgs/user.png" />
      </div>
    </div>
  </div>
</template>
<script lang="ts">
// import { ref } from "vue";
export default {
  name: "NaviGation",
  setup() {
    console.log("setup");
    // 导航项
    type NavType = {
      title: string;
      path: string;
    };
    let navList: NavType[] = [
      { title: "首页", path: "/index" },
      { title: "我的", path: "/my" },
      { title: "关于", path: "/about" },
      { title: "新闻", path: "/news" },
      { title: "资料", path: "/profile" },
      { title: "HTML", path: "/html" },
    ];
    return {
      navList,
    };
  },
};
</script>
<style scoped lang="scss">
@import "../../style/common.scss";
.navgation {
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  height: $nav_height;
  width: 100%;
  z-index: 999;
  background-color: rgb($main_color, 1);
  .nav-center {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 1400px;
    height: 100%;
    .left-log {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      width: 80px;
      height: 100%;
      img {
        width: 60px;
        height: 60px;
      }
      .name {
        color: #fff;
      }
    }
    .right-user {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      background-color: #f5f5f5;
      overflow: hidden;
      img {
        width: 100%;
        height: 100%;
      }
    }
    ul {
      display: flex;
      align-items: center;
      height: 100%;
      margin-bottom: 0;
      li {
        padding: 0px 12px;
        a {
          display: inline-block;
          padding: 10px 4px;
          color: #fff;
          box-sizing: border-box;
          border: 1px solid transparent;
          cursor: pointer;
          &:hover {
            color: $hover_color;
            border-bottom: 1px solid $hover_color;
          }
        }
      }
    }
  }
}
.active {
  color: $hover_color !important;
  border-bottom: 1px solid $hover_color !important;
}
</style>
